package logic

import (
	"context"
	"month5/common/proto/user"
	"month5/service/server"
)

type UserServer struct {
	user.UnimplementedUserServer
}

func (u UserServer) Login(ctx context.Context, in *user.LoginReq) (*user.LoginResp, error) {
	login, err := server.Login(in)
	if err != nil {
		return nil, err
	}
	return login, nil
}

func (u UserServer) EatList(ctx context.Context, in *user.EatListReq) (*user.EatListResp, error) {
	eatList, err := server.EatList(in)
	if err != nil {
		return nil, err
	}
	return eatList, nil
}

func (u UserServer) CreatedOrder(ctx context.Context, in *user.CreatedOrderReq) (*user.CreatedOrderResp, error) {
	createdOrder, err := server.CreatedOrder(in)
	if err != nil {
		return nil, err
	}
	return createdOrder, nil
}

func (u UserServer) PayBack(ctx context.Context, in *user.PayBackReq) (*user.PayBackResp, error) {
	payBack, err := server.PayBack(in)
	if err != nil {
		return nil, err
	}
	return payBack, nil
}

func (u UserServer) OrderList(ctx context.Context, in *user.OrderListReq) (*user.OrderListResp, error) {
	orderList, err := server.OrderList(in)
	if err != nil {
		return nil, err
	}
	return orderList, nil
}

func (u UserServer) AddCoupon(ctx context.Context, in *user.AddCouponReq) (*user.AddCouponResp, error) {
	addCoupon, err := server.AddCoupon(in)
	if err != nil {
		return nil, err
	}
	return addCoupon, nil
}

func (u UserServer) LookCoupons(ctx context.Context, in *user.LookCouponsReq) (*user.LookCouponsResp, error) {
	lookCoupons, err := server.LookCoupons(in)
	if err != nil {
		return nil, err
	}
	return lookCoupons, nil
}
